package wiki.kaizen.cloud.plugin.spring.serializer;

import com.alibaba.fastjson.serializer.JSONSerializer;
import com.alibaba.fastjson.serializer.ObjectSerializer;
import com.alibaba.fastjson.serializer.SerializeWriter;

import java.io.IOException;
import java.lang.reflect.Type;

public abstract class AbstractLocalTemporalSerializer implements ObjectSerializer {
    @Override
    public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
        SerializeWriter writer = serializer.getWriter();
        if (object==null){
            writer.writeNull();
        }else{
            this.write(writer,object);
        }
    }

    public abstract void write(SerializeWriter writer,Object object);
}
